package com.luck.redis;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 监听Redis是否启动
 * Created by Hua wb on 2018/11/16.
 */
@Configuration
public class RedisListener implements ServletContextListener {
    private static Logger logger = Logger.getLogger(RedisListener.class);
    @Autowired
    private RedisService redisService;
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        RedisConfig.IS_CONNECTION = redisService.isConnection();
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
